|
|
|
 | In the ToggleButtons routine, you change the Caption of the Close command button to become Cancel. This avoids you having to place another command button on the form just to cancel changes made to the form. In addition, youll toggle all the Enabled properties the command buttons, the DataList control, and the data control to be the opposite of what they are now. When the user first enters the add or edit mode, this will make sure the user finishes what he or she is doing before performing any other actions. After the user saves the data, you can then call the ToggleButtons routine again. This will turn these controls back to their original state. |
|
|
|
|
|
|
At some point, the user will probably need to delete a record from a table. In order to accomplish this, you need to apply the Delete method to the Recordset object. The Delete method deletes the current row from the underlying base table and from the recordset. |
|
|
|
|
| Add Code to the Delete Command Button 1. Double-click the Delete command button. 2. Add the following code to the cmdDelete_Click event: | | Private Sub cmdDelete_Click()
Dim intResponse As Integer
Beep
intResponse = MsgBox("Delete the current Employee", _
vbYesNo + vbQuestion, _
"Delete Employee")
If intResponse = vbYes Then datEmployees.Recordset.Delete Call DataReposition
End If
End Sub |
|
|
|